home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
051-075
/
074
/
control
/
gadgets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
23KB
|
598 lines
/*********************************************************************/
/* */
/* Copyright (c) 1987 */
/* Commodore-Amiga, Inc. */
/* All rights reserved. */
/* */
/* */
/* Unlimited non-comercial use of this program is given, */
/* provided this notice is left intact. */
/* andy finkel */
/* */
/*********************************************************************/
#include "exec/types.h"
#include "intuition/intuition.h"
#define OK 1
#define CANCEL 2
#define NUMBER1 3
#define NUMBER2 4
#define NUMBER3 5
#define NUMBER4 6
#define NUMBER5 7
#define NUMBER6 8
#define NUMBER7 9
#define NUMBER8 10
#define BNUMBER0 12
#define BNUMBER1 13
#define BNUMBER2 14
#define BNUMBER3 15
#define BNUMBER4 16
#define BNUMBER5 17
#define BNUMBER6 18
#define BNUMBER7 19
#define BNUMBER8 20
#define BNUMBER9 21
#define BNUMBER10 22
#define BNUMBER11 23
#define BLUE 0
#define WHITE 1
#define BLACK 2
#define RED 3
#define INPUTWIDTH 80
#define INPUTHEIGHT 10
#define OKWIDTH 20
#define OKHEIGHT 10
#define CANCELWIDTH 52
#define CANCELHEIGHT 10
#define BITWIDTH 16
#define BITHEIGHT 10
char buffer1[10];
char buffer2[10];
char buffer3[10];
char buffer4[10];
char buffer5[10];
char buffer6[10];
char buffer7[10];
char buffer8[10];
char ubuffer1[10];
char ubuffer2[10];
char ubuffer3[10];
char ubuffer4[10];
char ubuffer5[10];
char ubuffer6[10];
char ubuffer7[10];
char ubuffer8[10];
SHORT Inputxys[] = { /* String input gadget xy pairs */
0,0,
INPUTWIDTH+1,0,
INPUTWIDTH+1,INPUTHEIGHT,
0,INPUTHEIGHT,
0,0
};
struct Border InputBorder = { /* border for String input gadget */
-1,-1, /* left,top */
WHITE,RED,JAM1, /* front,back,drawmode */
5, /* # of xy pairs */
Inputxys, /* array of xy pairs */
NULL /* ptr to another border */
};
SHORT Okxys[] = { /* OK gadget xy pairs */
0,0,
OKWIDTH+1,0,
OKWIDTH+1,OKHEIGHT+1,
0,OKHEIGHT+1,
0,0
};
struct Border OkBorder = { /* border for OK gadget */
-1,-1, /* left,top */
WHITE,BLACK,JAM1, /* front,back,drawmode */
5, /* # of xy pairs */
Okxys, /* array of xy pairs */
NULL /* ptr to another border */
};
SHORT Cancelxys[] = { /* CANCAL gadget xy pairs */
0,0,
CANCELWIDTH+1,0,
CANCELWIDTH+1,CANCELHEIGHT+1,
0,CANCELHEIGHT+1,
0,0
};
struct Border CancelBorder = { /* border for CANCEL gadget */
-1,-1, /* left,top */
WHITE,RED,JAM1, /* front,back,drawmode */
5, /* # of xy pairs */
Cancelxys, /* array of xy pairs */
NULL /* ptr to another border */
};
SHORT Bitxys[] = { /* bit gadget xy pairs */
0,0,
BITWIDTH+1,0,
BITWIDTH+1,BITHEIGHT+1,
0,BITHEIGHT+1,
0,0
};
struct Border BitBorder = { /* border for bit gadget */
-1,-1, /* left,top */
WHITE,RED,JAM1, /* front,back,drawmode */
5, /* # of xy pairs */
Bitxys, /* array of xy pairs */
NULL /* ptr to another border */
};
struct StringInfo field1 = {
buffer1, /* buffer */
ubuffer1, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field2 = {
buffer2, /* buffer */
buffer2, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field3 = {
buffer3, /* buffer */
ubuffer3, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field4 = {
buffer4, /* buffer */
ubuffer4, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field5 = {
buffer5, /* buffer */
ubuffer5, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field6 = {
buffer6, /* buffer */
ubuffer6, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field7 = {
buffer7, /* buffer */
ubuffer7, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct StringInfo field8 = {
buffer8, /* buffer */
ubuffer8, /* undo buffer */
7, /* char posn in buffer */
8, /* max # of chars */
};
struct IntuiText text1 = {
WHITE,RED,JAM1,-50,0,0,"CMap:",NULL};
struct IntuiText text2 = {
WHITE,RED,JAM1,-50,0,0,"Mode:",NULL};
struct IntuiText text3 = {
WHITE,RED,JAM1,-50,0,0,"SrcX:",NULL};
struct IntuiText text4 = {
WHITE,RED,JAM1,-50,0,0,"SrcY:",NULL};
struct IntuiText text5 = {
WHITE,RED,JAM1,-50,0,0,"SrcW:",NULL};
struct IntuiText text6 = {
WHITE,RED,JAM1,-50,0,0,"SrcH:",NULL};
struct IntuiText text7 = {
WHITE,RED,JAM1,-50,0,0,"DCol:",NULL};
struct IntuiText text8 = {
WHITE,RED,JAM1,-50,0,0,"DRow:",NULL};
struct IntuiText btext0 = {
WHITE,RED,JAM1,0,0,0,"MC",NULL};
struct IntuiText btext1 = {
WHITE,RED,JAM1,0,0,0,"MR",NULL};
struct IntuiText btext2 = {
WHITE,RED,JAM1,0,0,0,"FC",NULL};
struct IntuiText btext3 = {
WHITE,RED,JAM1,0,0,0,"FR",NULL};
struct IntuiText btext4 = {
WHITE,RED,JAM1,0,0,0,"FR",NULL};
struct IntuiText btext5 = {
WHITE,RED,JAM1,0,0,0,"FC",NULL};
struct IntuiText btext6 = {
WHITE,RED,JAM1,0,0,0,"CE",NULL};
struct IntuiText btext7 = {
WHITE,RED,JAM1,0,0,0,"AS",NULL};
struct IntuiText btext8 = {
WHITE,RED,JAM1,0,0,0,"D1",NULL};
struct IntuiText btext9 = {
WHITE,RED,JAM1,0,0,0,"D2",NULL};
struct IntuiText btext10 = {
WHITE,RED,JAM1,0,0,0,"D3",NULL};
struct IntuiText btext11 = {
WHITE,RED,JAM1,-48,0,0,"Spec: D4",NULL};
struct IntuiText OKText = {
WHITE,RED,JAM1,2,0,0,"OK",NULL};
struct IntuiText CancelText = {
WHITE,RED,JAM1,2,0,0,"CANCEL",NULL};
struct Gadget sGadget[] = { /* the input gadget */
{
NULL, /* ptr to next gadget */
60,20,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadet_Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text1, /* text for input prompt */
0, /* mutual exclude */
&field1, /* special info */
NUMBER1, /* ID */
NULL /* UserData */
},
{
&sGadget[0], /* ptr to next gadget */
60,30,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadet_Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text2, /* text for input prompt */
0, /* mutual exclude */
&field2, /* special info */
NUMBER2, /* ID */
NULL /* UserData */
},
{
&sGadget[1], /* ptr to next gadget */
60,40,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* GadetFlags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text3, /* text for input prompt */
0, /* mutual exclude */
&field3, /* special info */
NUMBER3, /* ID */
NULL /* UserData */
},
{
&sGadget[2], /* ptr to next gadget */
60,50,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text4, /* text for input prompt */
0, /* mutual exclude */
&field4, /* special info */
NUMBER4, /* ID */
NULL /* UserData */
},
{
&sGadget[3], /* ptr to next gadget */
60,60,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text5, /* text for input prompt */
0, /* mutual exclude */
&field5, /* special info */
NUMBER5, /* ID */
NULL /* UserData */
},
{
&sGadget[4], /* ptr to next gadget */
60,70,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text6, /* text for input prompt */
0, /* mutual exclude */
&field6, /* special info */
NUMBER6, /* ID */
NULL /* UserData */
},
{
&sGadget[5], /* ptr to next gadget */
60,80,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text7, /* text for input prompt */
0, /* mutual exclude */
&field7, /* special info */
NUMBER7, /* ID */
NULL /* UserData */
},
{
&sGadget[6], /* ptr to next gadget */
60,90,INPUTWIDTH,INPUTHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY, /* Activation Flag */
STRGADGET, /* gadget type */
&InputBorder, /* gadget render */
NULL, /* select render */
&text8, /* text for input prompt */
0, /* mutual exclude */
&field8, /* special info */
NUMBER8, /* ID */
NULL /* UserData */
}
};
struct Gadget bgadget[] = { /* the bit gadgets */
{
&sGadget[7], /* ptr to next gadget */
258,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext0, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER0, /* ID */
NULL /* UserData */
},
{
&bgadget[0], /* ptr to next gadget */
240,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext1, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER1, /* ID */
NULL /* UserData */
},
{
&bgadget[1], /* ptr to next gadget */
222,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext2, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER2, /* ID */
NULL /* UserData */
},
{
&bgadget[2], /* ptr to next gadget */
204,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext3, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER3, /* ID */
NULL /* UserData */
},
{
&bgadget[3], /* ptr to next gadget */
186,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext4, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER4, /* ID */
NULL /* UserData */
},
{
&bgadget[4], /* ptr to next gadget */
168,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext5, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER5, /* ID */
NULL /* UserData */
},
{
&bgadget[5], /* ptr to next gadget */
150,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext6, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER6, /* ID */
NULL /* UserData */
},
{
&bgadget[6], /* ptr to next gadget */
132,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Fllags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext7, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER7, /* ID */
NULL /* UserData */
},
{
&bgadget[7], /* ptr to next gadget */
114,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Fllags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext8, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER8, /* ID */
NULL /* UserData */
},
{
&bgadget[8], /* ptr to next gadget */
96,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Fllags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext9, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER9, /* ID */
NULL /* UserData */
},
{
&bgadget[9], /* ptr to next gadget */
78,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Fllags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext10, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER10, /* ID */
NULL /* UserData */
},
{
&bgadget[10], /* ptr to next gadget */
60,110,BITWIDTH,BITHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Fllags */
RELVERIFY|TOGGLESELECT, /* Activation Flag */
BOOLGADGET, /* gadget type */
&BitBorder, /* gadget render */
NULL, /* select render */
&btext11, /* text for input prompt */
0, /* mutual exclude */
NULL, /* special info */
BNUMBER11, /* ID */
NULL /* UserData */
}
};
struct Gadget OKGadget = {
&bgadget[11]
256,140,OKWIDTH,OKHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|ENDGADGET, /* Activation flag */
BOOLGADGET, /* gadget type */
&OkBorder, /* gadget render */
NULL, /* select render */
&OKText,
0, /* mutual exclude */
NULL, /* special info */
OK, /* ID */
NULL /* UserData */
};
struct Gadget CancelGadget = {
&OKGadget,
160,140,CANCELWIDTH,CANCELHEIGHT, /* left,top,width,height */
GADGHCOMP, /* Gadget Flags */
RELVERIFY|ENDGADGET, /* Activation flag */
BOOLGADGET, /* gadget type */
&CancelBorder, /* gadget render */
NULL, /* select render */
&CancelText
0, /* mutual exclude */
NULL, /* special info */
CANCEL, /* ID */
NULL /* UserData */
};
struct IntuiText projectext[] = {
{
BLUE, WHITE, JAM2, /* FrontPen, BackPen, DrawMode */
0, 20, /* LeftEdge, TopEdge */
NULL, /* ITextFont */
"\251 1987 Commodore", /* IText */
NULL /* NextText */
},
{
BLUE, WHITE, JAM2, /* FrontPen, BackPen, DrawMode */
0, 10, /* LeftEdge, TopEdge */
NULL, /* ITextFont */
"By Andy Finkel", /* IText */
&projectext[0] /* NextText */
}
{
BLUE, WHITE, JAM2, /* FrontPen, BackPen, DrawMode */
0, 0, /* LeftEdge, TopEdge */
NULL, /* ITextFont */
"Printer Driver Control", /* IText */
&projectext[1] /* NextText */
}
};
struct MenuItem projectitems[] = {
{
NULL, /* next item */
0, 0, 180, 30, /* LeftEdge, TopEdge, Width, Height */
ITEMENABLED | ITEMTEXT | HIGHCOMP,
0, /* mutual exclude */
(APTR)&projectext[2], /* ItemFill */
NULL, /* SelectFill */
NULL, /* Command */
NULL, /* SubItem */
NULL /* NextSelect */
}
};
struct Menu menus[] = {
{
NULL /* next menu */
10+0, 0, 100, 0, /* LeftEdge, TopEdge, Width, Height */
MENUENABLED, /* flags */
"About", /* name */
projectitems /* first item */
},
};